
<%@ page contentType="text/html;charset=UTF-8"  pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
  <title>Document</title>
  <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/back/easyui/themes/default/easyui.css">
  <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/back/easyui/themes/icon.css">
  <script type="text/javascript" src="${pageContext.request.contextPath}/back/easyui/js/jquery.min.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/back/easyui/js/jquery.easyui.min.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/back/easyui/js/form.validator.rules.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath }/back/easyui/js/easyui-lang-zh_CN.js"></script>

  <script type="text/javascript">
    //系统菜单模块
    $(function(){
        $.get("${pageContext.request.contextPath}/back/menu/menu.json",function(result){

            $.each(result,function(i,menu){

                var content = "<div style='text-align:center;'>";

                $.each(menu.children,function(index,child){
                    content += "<div style='margin-top:10px;'><a class='easyui-linkbutton' onclick='addTabs("+ JSON.stringify(child) +")' data-options=\"iconCls:'"+ child.iconCls +"',plain:true\" style='width:90%;border:1px #E0ECFF solid;' \">"+ child.title + "</a></div>";
                });
                content +="</div>";

                $("#backmenu").accordion('add',{
                    title:menu.title,
                    iconCls:menu.iconCls,
                    content:content,
                    selected:false
                });
            });

        });

    })

     function addTabs(child){
        //如果存在则不添加
         if(!$("#backtab").tabs('exists',child.title)){
             $("#backtab").tabs('add',{
                 title:child.title,
                 iconCls:child.icon,
                 closable:true,
                 href:'${pageContext.request.contextPath}/'+child.href
             });
         }else{
             $("#backtab").tabs('select',child.title);
         }
     }


  </script>
</head>
<body>
<div id="cc" class="easyui-layout" style="width:600px;height:400px;" data-options="fit:true">
  <div data-options="region:'north',split:true,href:'${pageContext.request.contextPath}/back/head/head.jsp'" style="height:90px;" ></div>
  <div data-options="region:'south',split:false,href:'${pageContext.request.contextPath}/back/footer/footer.jsp'" style="height:80px;"></div>
  <div data-options="region:'west',split:false" style="width:220px;">

    <div id="backmenu" class="easyui-accordion" data-options="fit:true"></div>

  </div>


    <div data-options="region:'center'" >

      <div id="backtab" class="easyui-tabs" data-options="fit:true,title:'tab'">

      </div>

    </div>
</div>
</body>
</html>
